package com.library.entity;

import com.library.util.MD5Util;
import org.springframework.security.crypto.password.PasswordEncoder;

public class MyPasswordEncoder implements PasswordEncoder {
    @Override
    public String encode(CharSequence rawPassword) {
        //return MD5Util.string2MD5((String)rawPassword);
        return MD5Util.convertMD5((String)rawPassword);
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return encodedPassword.equals(MD5Util.convertMD5((String)rawPassword));
    }
}
